GBML manual / Constants

EASE_BACK_IN_OUT

Pulls back a little, rushes across, overshoots the end a little and settles on it. The number goes about 10% outside the range at both ends.

Syntax

EASE_BACK_IN_OUT: constant

Description

The "back in out" curve for tween and tween_to: it pulls back, rushes across, runs a little too far and settles. After a quarter of the time it is at -0.10 (the pull-back), after half exactly 0.50, and after three quarters at 1.10 (just past the end).

The number leaves the range

Most curves keep the number between from and to. This one does not, at either end. For a moment the number goes about 10% of the distance behind from, and later about 10% past to: a number tweened from 100 to 200 dips to about 90, crosses the middle, reaches about 210 and comes back to 200.

When the number is a position, that is the point: a move with a wind-up and a follow-through. When the number has to stay in a range it is a problem, at both ends:

tween_to(volume, 100, 60, EASE_BACK_IN_OUT);   // the volume dips below 0 first and goes above 100 at the end: don't do this to a number with limits

For a number that must stay between its two ends, use a sine or quad curve, or a bounce, which never goes outside them. It does arrive exactly: after the end the number is exactly to, every frame.

A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball sinks a little past the green line and then comes back up onto it. In the in row it first rises a little above the dim line, the wrong way, and then sinks down to the green line. The in out row does both. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball sinks a little past the green line and then comes back up onto it. In the in row it first rises a little above the dim line, the wrong way, and then sinks down to the green line. The in out row does both. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.
A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball sinks a little past the green line and then comes back up onto it. In the in row it first rises a little above the dim line, the wrong way, and then sinks down to the green line. The in out row does both. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.

The same tween three ways, one row for each of EASE_BACK_IN, EASE_BACK_OUT and EASE_BACK_IN_OUT. The ball's height is the number (like tween_to(y, ...) moving something down), and it drifts right at a steady speed only so that the shape can be seen. The dim line is where the number starts and the green line is where it ends: look for the ball going past the green line, or behind the dim one. Real pictures from a Game Boy Advance ROM, 4 frames apart, played at the speed of the console. A viewer that does not animate shows the first picture, the finished one.

Example

tween_to(y, y + 60, 60, EASE_BACK_IN_OUT);

y grows downward, so the walker first goes about 6 pixels up (the wrong way, a tenth of the 60 it is going to travel), then drops, goes about 6 pixels too far down, and comes back to rest exactly 60 pixels below where it began.

Good for a move that should feel physical in both directions, like a heavy door that swings back a little before it opens and overshoots a little before it stops.

See also: tweentween_totween_from_to